package com.zktr.service;

import java.util.List;
import java.util.Map;

import com.zktr.dao.GoodsDao;
import com.zktr.dao.OrdersDao;
import com.zktr.pojo.Goods;
import com.zktr.pojo.Orders;
import com.zktr.pojo.PageBean;

/**
 *�����������ҵ��
 * @author 123
 *
 */
public class OrdersService {
	private OrdersDao dao=new OrdersDao();
	/**
	 * ����ͨ��
	 * @param args
	 */
	/*public static void main(String[] args) {
		OrdersService service=new OrdersService();
		PageBean<Orders> findOrders = service.findAllOrders(1, 3);
		List<Orders> beanList = findOrders.getBeanList();
		for (Orders orders : beanList) {
			System.out.println(orders);
		}
		System.out.println(findOrders.getPc()+"----"+findOrders.getPs()+findOrders.getTp()+findOrders.getTr());
	}*/
	/**
	 * �����б���ҳ��ѯȫ��
	 * @return 
	 */
	public PageBean<Orders>  findAllOrder(int pc,int ps) {
		Map<Integer, List<Orders>> selectBooks = dao.selectOrders(pc, ps);
		PageBean<Orders> bean=new PageBean<Orders>();
		bean.setPc(pc);//ҳ��
		bean.setPs(ps);//ҳ��С
		bean.setBeanList(selectBooks.get(0));
		bean.setTr(dao.selectOrdersCount());//�ܼ�¼����
		return bean;
	}
	/***
	 * 查询商品信息：
	 * @param goodsname 
	 */
	public Goods findOneGoods(String goodsname) {
		GoodsDao gdao=new GoodsDao();
		return gdao.queryOneGoods(goodsname);
	}
}
